<!-- src/components/ECharts.vue -->
<template>
<div ref="chart"></div>
</template>

<script>
import * as echarts from 'echarts';

export default {
    name: 'ECharts',
    props: ['options'],
    mounted() {
        this.chart = echarts.init(this.$refs.chart);
        this.chart.setOption(this.options);
    },
    watch: {
        options: {
            handler(newOptions) {
                this.chart.setOption(newOptions);
            },
            deep: true,
        },
    },
};
</script>